﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace MonoTouchAutoBind
{
    abstract class MonotouchBind
    {

        public string BindCode { get; protected set; }
        //public virtual bool IsContant { get; protected set; }
        public virtual ParseStatus ParseFiniseStatus { get; protected set; }
        public virtual string EndString { get; protected set; }

        public List<string> DelegateCodeList;


        public virtual bool CanParse(string code)
        {
            return false;
        }
        public virtual int PushCode(string code)
        {
            return code.Length;
        }
        //public virtual string GenerateDelegate()
        //{
        //    return "";
        //}
        public virtual string GenerateCSharp()
        {
            return "";
        }

        //public virtual void CreateDelegateCode(string code)
        //{
        //    if (DelegateCodeCreated != null)
        //    {
        //        DelegateCodeCreated(this, new DelegateCodeCreateEvent(code));
        //    }
        //}

        public MonotouchBind()
        {
            this.ParseFiniseStatus = ParseStatus.UnStart;
            EndString = ";";
            DelegateCodeList = new List<string>();
        }



        //public event EventHandler<DelegateCodeCreateEvent> DelegateCodeCreated;
    }


    public class DelegateCodeCreateEvent : EventArgs
    {
        public string CSharpCode { get; private set; }
        public DelegateCodeCreateEvent(string code)
        {
            this.CSharpCode = code;
        }
    }

    public enum ParseStatus
    { 
        UnStart,
        Processing,
        Finished
    }
}
